#import "FlutterOupayPlugin.h"
#import "NSString+MD5.h"
#import "OupayCCBPay.h"

@implementation FlutterOupayPlugin
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
  FlutterMethodChannel* channel = [FlutterMethodChannel
      methodChannelWithName:@"flutter_oupay"
            binaryMessenger:[registrar messenger]];
  FlutterOupayPlugin* instance = [[FlutterOupayPlugin alloc] init];
  [registrar addMethodCallDelegate:instance channel:channel];
}

- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
  //获取版本号 这是默认的
  if ([@"getPlatformVersion" isEqualToString:call.method]) {
    result([@"iOS " stringByAppendingString:[[UIDevice currentDevice] systemVersion]]);
  }
  //走建行支付通道
  else if([@"ccbnetPay" isEqualToString:call.method]){
      NSString * payInfo = call.arguments[@"payInfo"];
      [OupayCCBPay startPay:payInfo result:result ];
  } else {
    result(FlutterMethodNotImplemented);
  }
}

@end
